﻿using OAS.Application.MenuApp.Dtos;
using OAS.Application.MenuApp.Services;
using OAS.Application.DepartmentApp.Services;
using OAS.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OAS.Application.System.Dtos;

namespace OAS.Application.DepartmentApp
{
    public class DepartmentController : IDynamicApiController
    {
        private readonly ISqlSugarClient db;
        private readonly IDepartmentService _departmentService;
        public DepartmentController(IDepartmentService departmentService, ISqlSugarClient db)
        {
            this.db = db;
            _departmentService = departmentService;
        }
        public async Task<List<Department>> GetAllDepartment()
        {
            return await _departmentService.GetAllDepartment();
        }
        [HttpPost]
        public async Task<object> GetDepartmentList(DtoQuery dto)
        {
            return await _departmentService.GetDepartmentList(dto);
        }
        public async Task AddDepartment(Department department)
        {
            await _departmentService.AddDepartment(department);
        }
        public async Task UpdateDepartment(Department department)
        {
            await _departmentService.UpdateDepartment(department);
        }
        public async Task DeleteDepartment([FromBody] string[] ids)
        {
            await _departmentService.DeleteDepartment(ids);
        }
    }
}
